function checktoken() {
  return async function (ctx, next) {
    console.log('这是中间件');
    const token = ctx.request.headers.authorization.split(' ')[1];
    const decode = ctx.app.jwt.verify(token, ctx.app.config.jwt.secret)
    if (decode.username) {
      console.log('用户校验成功');

      await next()
    } else {
       console.log('用户校验失败');
    }
  }
}

module.exports = checktoken